import type { CSSProperties, ReactNode } from "react";
import MonthCalender from "./MonthCalender";
import Header from "./Header";
import dayjs, { Dayjs } from "dayjs";
import cs from "classnames";
export interface CalendarProps {
  value: Dayjs;
  style?: CSSProperties;
  className?: string | string[];
  // 定制日期显示，会完全覆盖日期单元格
  dateRender?: (currentDate: Dayjs) => ReactNode;
  // 定制日期单元格，内容会被添加到单元格内，只在全屏日历模式下生效。
  dateInnerContent?: (currentDate: Dayjs) => ReactNode;
  // 国际化相关
  locale?: string;
  onChange?: (date: Dayjs) => void;
}
const value = dayjs(); // 获取当前时间

const Calendar = (props: CalendarProps) => {
  const { value, style, className } = props;

  const onChange = (value: Dayjs) => {
    console.log(value);
  };
  const classNames = cs("calendar", className);
  return (
    <div className={classNames} style={style}>
      <Header value={value} onChange={onChange} />

      <MonthCalender {...props} />
    </div>
  );
};

export default Calendar;
